home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / perlcl16.lha / perlclass1.6 / sample / tstio.c++ < prev   
C/C++ Source or Header  |  1992-10-26  |  819b  |  50 lines

  1. #include    <fstream.h>
  2. #include    <strstream.h>
  3. #include    <stdlib.h>
  4. #include    "perlclass.h"
  5. #include    "perlassoc.h"
  6.  
  7. void main()
  8. {
  9. ifstream fin("t.txt");
  10. ofstream fout("t2.txt");
  11.  
  12. PerlString s;
  13. PerlStringList l;
  14.  
  15.     while(fin >> s){
  16.     cout << "read in string: " << s << endl;
  17.     fout << s << endl;
  18.     }
  19.     
  20.     fin.close();
  21.     fout.close();
  22.     
  23.     fin.open("t.txt");
  24.     
  25.     fin >> l;
  26.     
  27.     cout << "List =" << endl << l << endl;
  28.  
  29. #if 1
  30.     strstream ss, iss;
  31.     ss << "one\n" << "two\nthree\nfour\n";
  32.     ss >> l;
  33.     cout << l << endl;
  34.     PerlList<int> il;
  35.     iss << 1 << " " << 2 << " " << 3 << " " << 4 << endl;
  36.     iss << "5 6 7 8 9" << endl;
  37.     iss >> il;
  38.     cout << il << endl;
  39. #endif
  40.  
  41.  
  42.     cout << "Start Typing:" << endl;
  43.     while(cin >> s){
  44.     cout << "read in string: " << s << endl;
  45.     }
  46.  
  47.     
  48.     
  49. }
  50.